using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Xml;

namespace Weathertastic
{
    /// <summary>
    /// Returns an Icon based on the weather condition.
    /// </summary>
    public static class ConditionToIcon
    {
        /// <summary>
        /// Heavy if/else to return the correct icon (created from PNG file)
        /// </summary>
        /// <param name="sCondition">The weather condition</param>
        /// <returns></returns>
        public static Image GetIcon(int iIcon)
        {
            //Theme Theme = new Theme();
            XmlDocument xFile = new XmlDocument();
            Settings Settings = new Settings();

            // TODO: Load some defaults if the theme file cannot be found

            xFile.Load("icons\\" + Settings.Theme + "\\theme.xml");
            XmlNode node = xFile.SelectSingleNode("//icon[@index='" + iIcon.ToString() + "']");
            
            return Image.FromFile("icons\\" + Settings.Theme + "\\" + node.InnerText);

        }
    }
}
